Passed
Push — master ( 021334...c7e546 )
by Dominik
09:43 queued 05:04
created

build-config.js ➔ getCopyConfig   A

Complexity

Conditions 1

Size

Total Lines 14
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 14
rs 9.85
c 0
b 0
f 0
cc 1
1
const host = 'https://flynt-components.local.blee.ch'
2
const themeName = 'flynt-components'
3
const dest = './dist'
4
5
const path = require('path')
6
7
function getCopyConfig (source) {
8
  return {
9
    from: source,
10
    to: './',
11
    ignore: [
12
      '*.js',
13
      '*.scss',
14
      '*.php',
15
      '*.twig',
16
      'screenshot.png',
17
      'README.md'
18
    ]
19
  }
20
}
21
22
module.exports = {
23
  webpack: {
24
    publicPath: path.join(`/app/themes/${themeName}/`, dest, '/'),
25
    entry: {
26
      'assets/main': './assets/main.js',
27
      'assets/admin': './assets/admin.js'
28
    },
29
    copy: [
30
      getCopyConfig('./Components/**/*'),
31
      getCopyConfig('./assets/**/*')
32
    ]
33
  },
34
  browserSync: {
35
    ghostMode: false,
36
    open: false,
37
    proxy: {
38
      target: host,
39
      ws: false
40
    },
41
    watchOptions: {
42
      ignoreInitial: true
43
    },
44
    injectChanges: true,
45
    reloadDebounce: 1000,
46
    ui: false,
47
    files: [
48
      '*.php',
49
      'templates/**/*',
50
      'lib/**/*',
51
      'inc/**/*',
52
      './Components/**/*.{php,twig}'
53
    ],
54
    watch: true,
55
    https: true
56
  },
57
  webpackDevMiddleware: {
58
    stats: false,
59
    writeToDisk: true
60
  },
61
  gulp: {
62
    dest: dest,
63
    rev: {
64
      src: dest + '/**/*.*',
65
      srcRevved: [dest + '/**/*.{js,css}', '!' + dest + '/style.css'],
66
      srcStatic: dest + '/**/*.{html,php,twig}',
67
      assetSrc: [
68
        dest + '/**/*',
69
        '!' + dest + '/**/*+(css|js|json|html|php|twig|pot|md|htc|swf|xap)',
70
        '!' + dest + '/style.css',
71
        '!' + dest + '/screenshot.png',
72
        '!' + dest + '/favicon.ico',
73
        '!' + dest + '/favicon.png',
74
        '!' + dest + '/apple-touch-icon-180x180.png',
75
        '!' + dest + '/apple-touch-icon.png',
76
        '!' + dest + '/**/screenshot.png'
77
      ],
78
      revvedFileExtensions: ['.js', '.css'],
79
      staticFileExtensions: ['.html', '.php', '.twig']
80
    },
81
    replaceVersion: {
82
      wordpress: {
83
        files: './style.css',
84
        from: /Version: (.*)/gi,
85
        to: 'Version: '
86
      },
87
      php: {
88
        files: '!(node_modules|dist)/**/*.php',
89
        from: '%%NEXT_VERSION%%'
90
      }
91
    }
92
  }
93
}
94